﻿__author__ = 'cloud'
from django import forms

from django.contrib.auth.forms import PasswordChangeForm
from clients.models import Client
import json

class ClientForm(forms.ModelForm):
    def __init__(self, *args, **kwargs):
        super(ClientForm, self).__init__(*args, **kwargs)
        if self.instance:
            client = self.instance
            if client.type == client.INDIVIDUAL:
                del self.fields['inn']
            else:
                del self.fields['pasnomer']
                del self.fields['passeria']
                del self.fields['paspodrazdelenie']
                del self.fields['pasdate']

    class Meta:
        model = Client
        exclude = ['id', 'comments']

